<template>
	<orh-table>
		<Button v-if="infoId" slot="option" type="primary" @click="update">编辑</Button>
		<student-basic-information-look slot="table" v-if="infoId" :infoId='infoId'></student-basic-information-look>
		<orh-sidebar v-model="isShow" :title="'修改'" cover slot="others">
			<operation v-if="show==2 && infoId" :typeother="'one'" :infoId='infoId' @showParent='showParent=>show=showParent' @backList='queryData'></operation>
		</orh-sidebar>
        <Spin slot="option" size="large" fix v-if="spinShow"></Spin>
	</orh-table>
</template>

<script>
  export default {
    components: {
        Operation: resolve => {require(['./../StudentBasicInformation/Operation.vue'], resolve);},
        StudentBasicInformationLook: resolve => {require(['./../Public/StudentBasicInformationLook.vue'], resolve);},

    },
    name: "studentfilesmodule-myinformationdetail",
    data() {
		return {
			infoId:null,
			isShow:false,
			spinShow:false,
			show:null,
		}
    },
    methods: {
		/************************************************************
		 *
		 * 获取数据
		 *
		 ************************************************************/
		queryData(){
			this.infoId = null
			this.spinShow=true
			this.$http.get('api/student/v1/studentbase/my_info').then(res=>{
				let data = JSON.parse(JSON.stringify(res.data))
				this.infoId = data.student_base_id
				this.spinShow=false
			}).catch(err => {
				console.log(err);
				if(err.code && err.code==422) {
					this.$Message.error(err.message);
				}
				this.spinShow=false
			})
		},

		/************************************************************
		 *
		 * 点击编辑
		 *
		 ************************************************************/
		update(){
			this.isShow=true;
			this.show=2;
		},

    },
    mounted() {
        this.queryData()
    }

  }
</script>
